import request from '@/utils/request'
import Cookies from 'js-cookie'

export function login(data) {
  return request({
    url: 'loginApi/login',
    method: 'post',
    data
  })
}

export function getInfo(data) {
  return request({
    url: 'auth/info/' + data,
    method: 'get'
  })
}

export function getCodeImg() {
  return request({
    url: 'auth/code',
    method: 'get'
  })
}

export function logout() {
  Cookies.set('Authorization', '', -1)
  Cookies.set('type', '', -1)
  Cookies.set('shopId', '', -1)
  this.$router.push('/login')
}

export function register(data) {
  return request({
    url: 'auth/register',
    method: 'post',
    data
  })
}

